package com.sky.controller.user;

import com.sky.entity.Dish;
import com.sky.result.Result;
import com.sky.service.DishService;
import com.sky.vo.DishListVo;
import com.sky.vo.DishVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/user/dish")
public class UserDishController {
    @Autowired
    private DishService dishService;

    @GetMapping("/list")
   @Cacheable(cacheNames = "dishCache",key = "#categoryId")
    public Result<List<DishVO>> dishList (Long categoryId){
        List<DishVO> list = dishService.categoryByIdListAndFlavor(categoryId);

        return Result.success(list);
    }


}
